const express = require("express");
const testController = require("../controller/testController");
const requireAuth = require("../middleware/requireAuth");
const router = express.Router({ mergeParams: true });

router
  .route("/")
  .post(requireAuth, testController.createTest)
  .get(requireAuth, testController.getAllTest);

router
  .route("/:id")
  .delete(requireAuth, testController.deleteTest)
  .patch(requireAuth, testController.updateTest);

router
  .route("/publish")
  .post(requireAuth, testController.publishTest) //发布试卷
  .get(requireAuth, testController.getPublishingTest); //获取正在发布的试卷

router.route("/published").get(requireAuth, testController.getPublishedTest); //获取已发布试卷标题（已发布+发布中)

module.exports = router;
